/*
 * @Author: Jiarun
 * @Date: 2021-06-02 15:05:33
 * @LastEditors: Jiarun
 * @LastEditTime: 2021-06-08 10:01:30
 * @Description: 此文件用来编写放置用户中断服务函数
 ************************************************************************
 * @attention
 * 建议无论中断服务函数中是否用到 RT-Thread 函数,
 * 都要添加 rt_interrupt_enter(), rt_interrupt_leave() 两组 API 进出中断;
 * 中断服务函数中用到 RT-Thread 函数时, 必须添加上述两组 API
 ************************************************************************
 */
#include "stm32f10x_it.h"
#include "rtthread.h"
#include "bsp_config.h"



void EXTI2_IRQHandler(void)
{
  /* enter interrupt */
	rt_interrupt_enter();  
	
	if(EXTI_GetITStatus(EXTI_Line2) != RESET)
	{
		/* add your code here */

		/* Clear the EXTI Line 0 */
		/* 清除中断挂起标志位，否则会因中断没被处理而再入中断，陷入循环 */
		EXTI_ClearITPendingBit(EXTI_Line2);
	}
	/* leave interrupt */
	rt_interrupt_leave();
}

void TIM3_IRQHandler(void)   //TIM3中断
{
	/* enter interrupt */
	rt_interrupt_enter(); 
	
	if (TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET)  //检查TIM3更新中断发生与否
	{
		TIM_ClearITPendingBit(TIM3, TIM_IT_Update  );  //清除TIMx更新中断标志 
		/* add your code here */

	}
	/* leave interrupt */
	rt_interrupt_leave();
}


void USART2_IRQHandler(void)
{
	/* enter interrupt */
	rt_interrupt_enter();
	
	if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)  //接收中断
	{
		// = (USART1->DR & (uint16_t)0x01FF);
	}
	
	/* leave interrupt */
	rt_interrupt_leave();
}

#if FINSGH_USING_INTERRUPT
void USART1_IRQHandler(void)
{
		DEBUG_USART_IRQHandler();
}
#endif
